//
//  SYDMentionDetailsController.m
//  PinGJByOwnerSide
//
//  Created by lantaiyuan on 2017/8/11.
//  Copyright © 2017年 lantaiyuan. All rights reserved.
//

#import "SYDMentionDetailsController.h"

@interface SYDMentionDetailsController ()
@property (weak, nonatomic) IBOutlet UILabel *bankCardLbl;
@property (weak, nonatomic) IBOutlet UILabel *moneyLbl;
@property (weak, nonatomic) IBOutlet UIButton *knowBtn;

@end

@implementation SYDMentionDetailsController
#pragma mark - 导航栏
- (void)navigationBarHandle{
    
    // 导航栏返回按钮
    WEAKSELF
    [self backButtonAction:^{
        [weakSelf.navigationController popViewControllerAnimated:YES];
    }];
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationBar.title = @"提现详情";
    [self navigationBarHandle];
    [self initMentionDetailUI];
}

-(void)initMentionDetailUI{
    [self.knowBtn drawBorderWithColor:GREEN_COLOR radius:5];
    self.bankCardLbl.text = self.bankCard;
    self.moneyLbl.text = self.amount;
    WEAKSELF
    self.knowBtn.eventTimeInterval = 3.0f;
    [[self.knowBtn rac_signalForControlEvents:UIControlEventTouchUpInside]subscribeNext:^(__kindof UIControl * _Nullable x) {
        [weakSelf getCashAddtion];
    }];
}
-(void)getCashAddtion{
    
    WEAKSELF
    [[SYDNetwork shareTool]getMineCashingAdditionWithCityCode:[YMSaveTool valueForKey:CityCode] amount:self.amount bankCard:[NSString bankNumToNormalNum:self.bankCard] userId:[YMSaveTool valueForKey:USER_ID] success:^(NSURLSessionDataTask *task, id responseObject) {
        @try {
            NSLog(@"----responseObject:%@",responseObject);
            if ([responseObject[@"statusCode"]integerValue] == 200) {
                //遍历控制器
                for (UIViewController *controller in self.navigationController.viewControllers) {
                    if ([controller isKindOfClass:[SYDMyWalletViewController class]]) {
                        [weakSelf.navigationController popToViewController:controller animated:YES];
                    }
                }
            }else{
                [SVProgressHUD displayInfoWithStatus:responseObject[@"msg"]];
            }
        } @catch (NSException *exception) {
            NSLog(@"%@",exception.description);
        } @finally {
            
        }
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"error:%@",error.description);
    }];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
